<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<!DOCTYPE html >
<html>
<head>
<script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.min.js"></script>
<link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
<script type="text/javascript">
	
	$(function(){
		$("#file_upload").uploadify({
			buttonText:'上传文件',
			auto:true,
			progressData:'speed',
			multi:false,
			height:25,
			width:60,
			overrideEvents:['onDialogClose'],
			fileTypeDesc:'文件格式:',
			queueID:'instructionfile',
			fileTypeExts:'*.xlsx;',
			fileSizeLimit:'15MB',
			swf:'plug-in/uploadify/uploadify.swf',	
			uploader:'uploadInstallRecordController.do?importExcel',
			onUploadStart : function(file) { 
				
				lockmask(true,'请稍等,导入中...');
				
			} ,
			onQueueComplete : function(queueData) {},
			onUploadSuccess : function(file, responseData, response){
				
				lockmask(false);
				var data = $.parseJSON(responseData);
				if(data.success){
					$.ajax({
						url : "uploadInstallRecordController.do?checkExcelSn",
						data : {
							"filePath" : data.obj.filePath,
							"fileLogId" : data.obj.id
							},
						cache : false,
						dataType : 'json',
						type : 'POST',
						success : function(data2){
							
							if(data2.success){
								top.window.tip(data2.msg);
								frameElement.api.reload(win,"zyInstallRecordController.do?zyInstallRecordCp");
								frameElement.api.close();
							}else{
								tip(data2.msg);
							}
						}
					});
				}else{
					tip(data.msg);
				}
			},onFallback : function(){
				tip("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试");
			},onSelectError : function(file, errorCode, errorMsg){
				switch(errorCode) {
					case -100:
						tip("上传的文件数量已经超出系统限制的"+$('#instruction').uploadify('settings','queueSizeLimit')+"个文件！");
						break;
					case -110:
						tip("文件 ["+file.name+"] 大小超出系统限制的"+$('#instruction').uploadify('settings','fileSizeLimit')+"大小！");
						break;
					case -120:
						tip("文件 ["+file.name+"] 大小异常！");
						break;
					case -130:
						tip("文件 ["+file.name+"] 类型不正确！");
						break;
					}
			},onUploadProgress : function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) {
			}
		});
	});
	</script>
</head>
<body style="overflow-y: hidden" scroll="no">
 <form  enctype="multipart/form-data" >
	<span id="file_upload"></span>
	<span id="msg"></span>
	</form>
</body>
</html>